#include <Utils/Type.h>
#include "HalAlgGloBuff.h"
#include "HalAlgSHA256.h"
#include "string.h"
#include "../alg_pr/ALGSha256_PR.h"


UINT32 HalAlgSHA256_Init(void)
{	
    SHA256_CONTEXT *l_ShaCtx;
    
    l_ShaCtx =(SHA256_CONTEXT*)GetAlgHashContextBuff();
    ALGSha256_PR_Init(l_ShaCtx);
    
    return RT_OK;
}

UINT32 HalAlgSHA256_Update(UINT8 *pBuf, UINT16 nSize)
{	
    SHA256_CONTEXT *l_ShaCtx;
    
    l_ShaCtx =(SHA256_CONTEXT*)GetAlgHashContextBuff();
    ALGSha256_PR_Update(l_ShaCtx, pBuf, nSize);
    
    return RT_OK; 
}

UINT32 HalAlgSHA256_Final(UINT8 *pHash)
{
    SHA256_CONTEXT* l_ShaCtx;
    
    l_ShaCtx =(SHA256_CONTEXT*)GetAlgHashContextBuff();
    ALGSha256_PR_Final(l_ShaCtx,pHash);
    
    return RT_OK;
}
